import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FeeKeyVO, FeeKeyForm, FeeKeyQuery } from '@/api/apartment/attribute/feeKey/types';

/**
 * 查询杂项费用名称列表
 * @param query
 * @returns {*}
 */

export const listFeeKey = (query?: FeeKeyQuery): AxiosPromise<FeeKeyVO[]> => {
  return request({
    url: '/apartment/feeKey/getAllList',
    method: 'post',
    data: query
  });
};

/**
 * 查询杂项费用名称详细
 * @param id
 */
export const getFeeKey = (id: string | number): AxiosPromise<FeeKeyVO> => {
  return request({
    url: '/apartment/feeKey/' + id,
    method: 'get'
  });
};

/**
 * 新增杂项费用名称
 * @param data
 */
export const addFeeKey = (data: FeeKeyForm) => {
  return request({
    url: '/apartment/feeKey',
    method: 'post',
    data: data
  });
};

/**
 * 修改杂项费用名称
 * @param data
 */
export const updateFeeKey = (data: FeeKeyForm) => {
  return request({
    url: '/apartment/feeKey',
    method: 'put',
    data: data
  });
};

/**
 * 删除杂项费用名称
 * @param id
 */
export const delFeeKey = (id: string | number | Array<string | number>) => {
  return request({
    url: '/apartment/feeKey/' + id,
    method: 'delete'
  });
};
